# coding:utf-8

#aop 面向切面 目的在于解耦
#oop 面向对象 目的在于抽象 新式类是广度优先,旧式类是深度优先


from datetime import datetime
def timer(func):
    def _timer(*args,**kw):
        begin=datetime.now().microsecond
        rs=func(*args,**kw)
        end=datetime.now().microsecond
        print "函数%s耗时%d" %(func.__name__,end-begin)
        return rs
    return _timer

@timer
def foo():
    print "hello foo"


foo()
